Python - Writing Binary Data to Files